<!--项目详情-计划-计划详情-->
<template>
  <div class="detail-wrap">
    <operateButton :options="operateBtn" />
    <PiTabs v-model:tabList="tabList" type="card" addable @handleEdit="handleTabsEdit"></PiTabs>
  </div>
</template>

<script setup name="partDetail">
import OperateButton from '@/views/components/operateButton.vue';
import baseInfo from './components/info/index.vue';
import planActivity from './components/planActivity/index.vue';

const route = useRoute();
const tabList = shallowRef([
  {
    label: '基础信息',
    name: 'baseInfo',
    component: baseInfo,
  },
  {
    label: '计划活动',
    name: 'planActivity',
    component: planActivity,
  },
]);
const operateBtn = reactive([
  {
    label: '编辑',
  },
]);

//状态的颜色
const statusColor = computed(() => {
  return (tit) => {
    if (!tit || typeof tit !== 'string') return '';

    let color = '';
    if (tit.includes('工作') || tit.includes('实施')) {
      color = 'primary';
    } else if (tit.includes('审阅') || tit.includes('试制')) {
      color = 'warning';
    } else if (tit.includes('已') || tit.includes('归档')) {
      color = 'success';
    } else if (tit.includes('废弃') || tit.includes('停用')) {
      color = 'danger';
    }
    return color;
  };
});

const handleTabsEdit = (targetName, action) => {
  console.log(`output->handleTabsEdit`, handleTabsEdit);
};
/**
 * 下载主内容
 * */
const downloadMain = () => {
  let formData = new FormData();
  formData.append('oid', route.query.oid);
};
</script>

<style lang="less">
.page-info {
  padding: 10px;
  box-sizing: border-box;
  background-color: var(--el-fill-color-blank);
  height: calc(100vh - 70px);
  overflow: hidden;
  .el-tabs {
    height: calc(100% - 30px);
  }
}
</style>
